package main

import (
	"fmt"
	"time"
)

func main() {
	c1 := make(chan int)
	c2 := make(chan int)
	defer close(c1)
	defer close(c2)
	go func() {
		for {

			select {
			case a := <-c1:
				fmt.Println("这是c1接收到的", a)

			case b := <-c2:
				fmt.Println("这是c2接收到的", b)
			}
		}
	}()
	var n int = 19
	fmt.Println(n)
	go func() {
		for i := 0; i < 100; i++ {
			if i%2 == 0 {
				c1 <- i
			} else {
				c2 <- i
			}
		}

	}()

	time.Sleep(2 * time.Second)
}
